////////////////////////////////////////////////////////////////////////////////
//                                                                            //
//  Filename:    PenguinPowerGuts.h                                           //
//  Developer:   Phillip Sharpless                                            //
//  Create date: 05/11/2006                                                   //
//                                                                            //
////////////////////////////////////////////////////////////////////////////////
//                                                                            //
//  Description: This is the class declaration for the slot gut of the        //
//               Australian Slot machine called Penguin Power                 //
//                                                                            //
////////////////////////////////////////////////////////////////////////////////
//        Copyright (c) 2006 - Realtime Gaming.  All rights reserved.         //
////////////////////////////////////////////////////////////////////////////////

#if !defined(__PENGUINPOWERGUTS_H__)
#define __PENGUINPOWERGUTS_H__

#if _MSC_VER > 1000
#pragma once
#endif // _MSC_VER > 1000

#include "slotguts.h"
#include "getrand.h"

class PenguinPowerGuts : public SlotGuts
{
	// Shared enums between client and server
	#include "PenguinPowerCommon.h"

public:
	PenguinPowerGuts();

	virtual ~PenguinPowerGuts();

	virtual void classifyStops( SpinLine* spinline, uint8* stops, uint8 bet, uint8 line,
		uint8& rtnresult, uint8& multiplier );

	virtual void classifyScatters( SlotSpin *spin );

    virtual bool8 isValidGuts();

    virtual void getGameModeMultiplierAndNoteId( uint8& nGameModeMultiplier, uint8& nNoteId );

protected:

	virtual void preSpinClassifyResults( SlotSpin *spin );

	virtual void Debug_SetLoserStops( uint8* pStops );

	virtual void initDebugFunctionMap();

	enum
	{
		EVT_DEBUG_FUNCTION_5_SPIN = BEGIN_SUB_MODIFY_NEXT_RESULT_FUNCTION_RANGE,
		EVT_DEBUG_FUNCTION_10_SPIN,
		EVT_DEBUG_FUNCTION_15_SPIN,
		EVT_DEBUG_FUNCTION_25_SPIN,

		EVT_DEBUG_FUNCTION_5X_PRIZE,
		EVT_DEBUG_FUNCTION_10X_PRIZE,
		EVT_DEBUG_FUNCTION_25X_PRIZE,
		EVT_DEBUG_FUNCTION_100X_PRIZE,
		EVT_DEBUG_FUNCTION_2S_PRIZE,
		EVT_DEBUG_FUNCTION_3S_PRIZE,
		EVT_DEBUG_FUNCTION_5S_PRIZE,
		EVT_DEBUG_FUNCTION_10S_PRIZE,
	};

	void DebugFeature_FiveSpins(SlotSpin *spin );
	void DebugFeature_TenSpins(SlotSpin *spin );
	void DebugFeature_FifteenSpins(SlotSpin *spin );
	void DebugFeature_TwentyFiveSpins(SlotSpin *spin );

	void DebugFeature_Prize_5X( SlotSpin *spin );
	void DebugFeature_Prize_10X( SlotSpin *spin );
	void DebugFeature_Prize_25X( SlotSpin *spin );
	void DebugFeature_Prize_100X( SlotSpin *spin );

	void DebugFeature_Prize_2S( SlotSpin *spin );
	void DebugFeature_Prize_3S( SlotSpin *spin );
	void DebugFeature_Prize_5S( SlotSpin *spin );
	void DebugFeature_Prize_10S( SlotSpin *spin );

    static int g_nFeatureSpins;
    static int g_nSlidePrize;

private:

	// Helpful lookup arrays.
	static SpinResult m_aLineWinSpinResults[][6];
	static SpinResult m_aScatterWinSpinResults[6];

	// Inline functions to use with the arrays that also do
	// bounds checking.
	static SpinResult lookupLineWinSpinResult(uint8 nIconType, uint8 nCount )
	{
		if ( nIconType < NUM_VALID_ICONS && nCount < 6 )
		{
			return m_aLineWinSpinResults[ nIconType ][ nCount ];
		}

		ASSERT( false );
		return EVT_INVALID;
	}

	static SpinResult lookupScatterWinSpinResult( uint8 nCount )
	{
		if ( nCount < 6 )
		{
			return m_aScatterWinSpinResults[ nCount ];
		}

		ASSERT( false );
		return EVT_INVALID;
	}

	//helper functions for classifyStops
	SpinResult getLineWinResultWithPossibleSubstitution(
		uint8* stops, uint8 testIcon, bool& bSubstitution ) const;

	//helper functions for classifyScatters
	void tryForJackpot( SlotSpin* spin );

	SpinResult getScatterWinResult( 
		SlotSpin* spin, int32& scatterPositions) const;


	void evaluateScatterWin( SlotSpin* spin, SpinResult srScatterResult, int32 scatterPositions);
	void evaluateFeatureTrigger( SlotSpin* spin, SpinResult srScatterResult, int32 scatterPositions);
	void evaluatePenguinSlide(SlotSpin* spin, int32 scatterPositions);

};


#endif // !defined(__PENGUINPOWERGUTS_H__)
